import IconFont from '@/components/IconFont';
import { CommonText } from '@/pages/OrderModule/common/components/CommonText';

export const TagLabel = (props) => {
  const { name, type='tag', noText=false } = props;
  const labelTypeMap = type==='tag'? {
    red: "iconbiaoqianhon",
    blue: "iconbiaoqianlan",
    yellow: "iconbiaoqianhuang",
    purple: "iconbiaoqianzi",
    black: "iconbiaoqianhei"
  } :{
    red: "iconqizhihong",
    blue: "iconqizhilan",
    yellow: "iconqizhihuang",
    green: "iconqizhilv",
    purple: "iconqizhizi",
    black: "iconqizhihei"
  };


  const labelColorMap = type==='tag'?  {
    red: "红色标",
    blue: "蓝色标",
    yellow: "黄色标",
    purple: "紫色标",
    black: "黑色标"
  }:{
    red: "红色旗",
        blue: "蓝色旗",
        yellow: "黄色旗",
        green: "绿色旗",
        purple: "紫色旗",
        black: "黑色旗"
  }
  if(Object.keys(labelColorMap).includes(name)) {
    return <CommonText text={noText? '': labelColorMap[name]} extractIcon={<IconFont style={{fontSize: 20,paddingTop:5}} type={labelTypeMap[name]}></IconFont>} />;
  } else {
    return name;
  }
};
